#调用我们的driver，已经封装一下功能的方法，其余的类都要继承这里面basePage
from selenium.webdriver.support.ui import Select
from webdriver.drvier_factory2 import DriverFactory

class BasePage():

    def __init__(self):
        #生成driver
        self.driver = DriverFactory.get_driver()

    #封装下拉选择的方法
    def select_option(self, select_element, option, text):
        """
        :param select_element: 定位的下拉选择框
        :param option: 选项值：1.下标索引 2.value属性 3.文本内容
        :param text: 具体传入的值
        """
        s1 = Select(select_element)
        if option == 1:
            s1.select_by_index(text)
        elif option == 2:
            s1.select_by_value(text)
        elif option == 3:
            s1.select_by_visible_text(text)



if __name__ == '__main__':
    BasePage()